﻿<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
	<CodeSnippet Format="1.0.0">
		<Header>
			<SnippetTypes>
				<SnippetType>Expansion</SnippetType>
			</SnippetTypes>
			<Title>Source Generator</Title>
			<Shortcut>sg</Shortcut>
			<Description>The snippet that allows you creating a source generator of convenience.</Description>
		</Header>
		<Snippet>
			<Declarations>
				<Literal Editable="true">
					<ID>source_gen_name</ID>
					<Default>MySource</Default>
				</Literal>
			</Declarations>
			<Code Language="csharp" Delimiter="$">
				<![CDATA[[Generator]
public sealed class $source_gen_name$Generator : ISourceGenerator
{
	/// <inheritdoc/>
	public void Execute(GeneratorExecutionContext context)
	{
		// TODO: Implement the logic.$end$
	}

	/// <inheritdoc/>
	public void Initialize(GeneratorInitializationContext context)
	{
		// TODO: If you want to call the local syntax receiver, just register it.
		//context.RegisterForSyntaxNotifications(static () => new Receiver());
		// Where the type 'SyntaxReceiver' is your own implemented type.

		// TODO: If you want to debug the source generator, just de-comment out the following code:
		//#if DEBUG
		//if (!System.Diagnostics.Debugger.IsAttached)
		//{
		//	System.Diagnostics.Debugger.Launch();
		//}
		//#endif
		// Also, you can use the snippet I provided, whose the shortcut is 'sgdbg',
		// which can be found in the folder 'required/vssnippets'.
	}
}
]]>
			</Code>
		</Snippet>
	</CodeSnippet>
</CodeSnippets>